// 有一些时候，他不是reason卖出，但是我觉得给他一个普通逆向的卖出还是可以的啊
module.exports = {
  // TODO 先放在逆向卖出，观察到还可以再给转reason
  sellIfReverseTrend () {
    if (
      this.tradeTime15mCycle === 4 &&
      this.analysisInfo1h.netChangeRatioUpDays === 1 &&
      this.analysisInfo1h.ema5A10Days === 1 &&
      this.analysisInfo1h.ema5A20Days === 1 &&
      this.analysisInfo1h.ema10A20Days === 1 &&
      // 或者就是4
      this.analysisInfo1h.kdjUpDays <= 2 &&
      this.analysisInfo1h.kdjDiff > 0 &&
      this.analysisInfo1h.netChangeRatio > 12 &&
      this.analysisInfo1d.ema5W10B20Days <= 1 &&
      this.analysisInfo1d.ema5B20Days >= 1 &&
      this.analysisInfo1d.ema5B10Days >= 1 &&
      // 或者16
      this.analysisInfo4h.ema5W10B20Days >= 12 &&
      this.analysisInfo15m.macdUpDays <= 4 &&
      this.analysisInfo15m.macd > 0 &&
      this.analysisInfo15m.netChangeRatioUpDays >= 4 &&
      this.analysisInfo15m.ema5W10A20Days <= 4 &&
      this.analysisInfo15m.ema5A10A20Days >= 1 &&
      this.analysisInfo15m.ema5W10A20Rate >= 12
    ) {
      this.setSellByReverse('sellIfReverseTrend-1', {
        level: 90
      })
    }
    if (
      this.tradeTime15mCycle === 4 &&
      this.analysisInfo1d.macdDownDays >= 4 &&
      this.analysisInfo1d.ema5W10B20Days >= 2 &&
      this.analysisInfo15m.kdjDownDays === 1 &&
      this.analysisInfo15m.lastKdjUpDays >= 10 &&
      this.analysisInfoFlag15m.getNetChangeRatioUpDaysInRange(15).days >= 14
    ) {
      this.setSellByReverse('sellIfReverseTrend-1-1', {
        level: 90
      })
    }
    if (
      this.analysisInfo15m.lastNetChangeRatioUpDays >= 12 &&
      this.analysisInfo15m.netChangeRatioDownDays === 1 &&
      this.analysisInfo15m.ema5W10A20Days >= 1
    ) {
      // 不是很好盈亏比太差，挣就几个点，亏是几十个点
      // 是不好
      // this.setSellByReverse('sellIfReverseTrend-2', {
      //   level: 90,
      //   rate: 0.5
      // })
    }
    if (
      this.is4hLastTime &&
      this.isUSDayChangeTime &&
      this.analysisInfo1d.macdUpDays === 1 &&
      this.analysisInfo1d.ema5A20Days === 1 &&
      this.analysisInfo1d.ema5A10Days === 1 &&
      this.analysisInfo4h.ema5A20Days === 1 &&
      this.analysisInfo4h.ema5A10Days === 1 &&
      // 或者70%
      this.analysisInfo4h.netChangeRatio >= 50 &&
      // 或者就是4
      (this.analysisInfo1h.macdUpDays <= 4 && this.analysisInfo1h.macdUpDays > 0) &&
      (this.analysisInfo1h.kdjUpDays <= 4 && this.analysisInfo1h.kdjUpDays > 0) &&
      (this.analysisInfo1h.ema5A20Days <= 4 && this.analysisInfo1h.ema5A20Days > 0) &&
      (this.analysisInfo1h.ema5A10Days <= 4 && this.analysisInfo1h.ema5A10Days > 0) &&
      this.analysisInfo15m.kdjDiff < 0 &&
      this.analysisInfo15m.isMacdDecline &&
      this.analysisInfo15m.netChangeRatioDownDays === 1
    ) {
      this.setSellByReverse('sellIfReverseTrend-3', {
        level: 90,
        rate: 1,
        minPositionConfig: 0.5
      })
    }
    if (
      // 或者增加判断this.isUSDayChangeTime
      this.is4hLastTime &&
      this.analysisInfo4h.kdjDiff < 0 &&
      this.analysisInfo4h.isMacdDecline &&
      this.analysisInfo1d.macdDownDays >= 4 &&
      this.analysisInfo1d.ema5W10B20Days >= 2 &&
      this.analysisInfo1h.macdDownDays >= 4 &&
      this.analysisInfo1h.ema5W10B20Days >= 2 &&
      this.analysisInfo15m.ema5A20Days === 1 &&
      this.analysisInfo15m.ema5A10Days === 1 &&
      this.analysisInfo15m.macdUpDays === 1 &&
      this.analysisInfo15m.kdjUpDays <= 1 &&
      this.analysisInfo15m.netChangeRatio > 5 &&
      // 或者15
      this.analysisInfo15m.highOpenRate > 12.5 &&
      (this.analysisInfo15m.netChangeRatio / this.analysisInfo15m.highOpenRate) <= 0.5
    ) {
      this.setSellByReverse('sellIfReverseTrend-4', {
        level: 90,
        rate: 1,
        minPositionConfig: 0.5
      })
    }
    if (
      this.tradeTime15mCycle === 4 &&
      this.is4hImportantChangeTime &&
      // 或者15
      this.analysisInfo15m.netChangeRatio >= 14 &&
      this.analysisInfo15m.macd > 0 &&
      this.analysisInfo15m.macdUpDays <= 2 &&
      // 或者16
      this.analysisInfo15m.ema5W10A20Days >= 16 &&
      // 或者25
      this.analysisInfo1h.netChangeRatio > 22.5 &&
      this.analysisInfo1h.kdjUpDays === 1 &&
      // 或者48
      this.analysisInfo1h.ema5W10A20Days >= 32
    ) {
      this.setSellByReverse('sellIfReverseTrend-5', {
        level: 90,
        rate: 1,
        minPositionConfig: 0.5
      })
    }
    if (
      this.tradeTime15mCycle === 4 &&
      this.analysisInfo15m.lastKdjUpDays >= 24 &&
      this.analysisInfo15m.kdjDiff < 0 &&
      this.analysisInfo15m.isMacdDecline &&
      this.analysisInfo15m.ema5W10A20Days >= 8
    ) {
      this.setSellByReverse('sellIfReverseTrend-6', {
        level: 90,
        rate: 1,
        minPositionConfig: 0.5
      })
    }
    if (
      this.tradeTime15mCycle === 4 &&
      this.is4hChangeTime &&
      this.analysisInfo15m.lastKdjUpDays >= 24 &&
      this.analysisInfo15m.kdjDiff < 0 &&
      this.analysisInfo15m.netChangeRatio < 0 &&
      this.analysisInfo15m.isMacdDecline &&
      this.analysisInfo15m.ema5W10A20Days >= 8 &&
      this.analysisInfo4h.ema5A20Days === 1 &&
      this.analysisInfo4h.ema10A20Days === 1
    ) {
      this.setSellByReverse('sellIfReverseTrend-7', {
        level: 90,
        rate: 1,
        minPositionConfig: 0.5
      })
    }
    if (
      this.analysisInfo15m.netChangeRatio < -15 &&
      this.analysisInfo15m.ema5A10A20Days >= 1
    ) {
      this.setSellByReverse('sellIfReverseTrend-8', {
        level: 90,
        rate: 1,
        minPositionConfig: 0.5
      })
    }
    if (
      this.analysisInfo1h.kdjDiff < 0 &&
      // 53
      this.analysisInfo15m.ema5W10A20Days >= 48 &&
      this.analysisInfo15m.macdDownDays <= 2 &&
      this.analysisInfo15m.macd < 0 &&
      this.analysisInfo15m.lastMacdUpDays <= 2 &&
      this.analysisInfo15m.lastMacdUpDays >= 1 &&
      // 或者32天
      this.analysisInfoFlag15m.getMacdDownDaysInRange(28) >= 26
    ) {
      this.setSellByReverse('sellIfReverseTrend-10', {
        level: 90,
        rate: 1,
        minPositionConfig: 0.5
      })
    }
    if (
      this.is4hChangeTime &&
      [1, 4].indexOf(this.tradeTime15mCycle) !== -1 &&
      this.analysisInfo15m.netChangeRatio >= 10 &&
      this.analysisInfo15m.ema5W10B20Days >= 1 &&
      this.analysisInfo15m.macdUpDays === 1 &&
      this.analysisInfo15m.kdjUpDays === 1 &&
      this.analysisInfo1h.macd < 0 &&
      this.analysisInfo1h.ema5B10Days >= 1 &&
      this.analysisInfo4h.kdjDiff < 0
    ) {
      this.setSellByReverse('sellIfReverseTrend-11', {
        level: 90,
        rate: 1,
        minPositionConfig: 0.5
      })
    }
  }
}
